package com.msos.dao.managerDao;

import com.msos.model.manager.Manager;
import com.msos.utils.DBUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

/**
 * 弟中弟：小邦
 */
public class ManagerDao {

    QueryRunner queryRunner = new QueryRunner(DBUtils.getDs());

    //根据用户名查询用户信息
    public Manager getManagerByName(String name) throws SQLException {
        return queryRunner.query("select * from manager where name=?",new BeanHandler<>(Manager.class),name);
    }

    //修改
    public Integer updatePasswordByManager(String password) throws SQLException {
        return queryRunner.update("update manager set password=?",password);
    }
}
